<!DOCTYPE html>
<!-- /* -->
<!--  * Copyright 2016-2021 the original author.All rights reserved. -->
<!--  * AiTeaSoft.com-->
<!--  * Kingstar(aiteasoft@163.com) -->
<!--  * The license,see the LICENSE file. -->
<!--  * Create on 2021-01-21 10:42:28 -->
<!--  * v1.9 -->
<!--  */ -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>assignexam</title>
	<link rel="stylesheet" type="text/css" href="../../css/je/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="../../css/je/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="../../css/je/themes/color.css">
	<link rel="stylesheet" type="text/css" href="../../css/je/themes/demo.css">
	<script type="text/javascript" src="../../js/jquery.js"></script>
	<script type="text/javascript" src="../../js/jquery.easyui.min.js"></script>
<!--	<script type="text/javascript" src="../../js/jqeEx.js"></script>  -->
	<script type="text/javascript" src="../../js/js-ex2.js"></script>
	<script type="text/javascript" src="../../js/suid-jq.js"></script>
<!--	<script type="text/javascript" src="../js/assignexam/assignexam.js"></script> -->
</head>
<body>
<!-- 	<table id="dg" title="Data List" class="easyui-datagrid" style="width:950px;height:535px" -->
<!-- 			toolbar="#toolbar"  fitColumns="true" pageSize=20  -->
<!-- 			data-options="height:'auto',singleSelect:false,collapsible:true, -->
<!-- 				method:'get',pagination:true,rownumbers:true" -->
<!-- 			> -->
	<table id="dg" title="Data List" class="easyui-datagrid" style="width:950px;height:600px"
			toolbar="#toolbar">
		<thead>
			<tr>
			    <th field="ck" checkbox="true"></th>
                 <th field="id"   hidden="true"  width="50">ID</th>
                 <th field="classno"   width="50">班级</th>
                 <th field="term"   width="50">学期</th>
                 <th field="examno"   width="50">考试批次</th>
                 <th field="subjectno"   width="50">科目编码</th>
                 <th field="subject"   width="50">科目名称</th>
                 <th field="creater"   width="50">创建者</th>
                 <th field="updater"   width="50">修改者</th>
                 <th field="remark"   width="50">备注</th>
                 <th field="status"   width="50">状态</th>
			</tr>
		</thead>
	</table>
	<div id="toolbar">
		<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="del()">Delete</a>
     <form name="formSearch" id="formSearch">
	    <span>班级:</span><input name="classno" style="line-height:26px;border:1px solid #ccc">
	    <span>学期:</span><input name="term" style="line-height:26px;border:1px solid #ccc">
	    <span>考试批次:</span><input name="examno" style="line-height:26px;border:1px solid #ccc">
	    <span>科目编码:</span><input name="subjectno" style="line-height:26px;border:1px solid #ccc">
	    <span>科目名称:</span><input name="subject" style="line-height:26px;border:1px solid #ccc">
	    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search"  plain="true" onclick="find()">Search</a>
     </form>
	 </div>
	
  
	
	
	<script type="text/javascript">
	
	/*
	 * Copyright 2016-2021 the original author.All rights reserved.
	 * AiTeasoft.com
	 * Kingstar(aiteasoft@163.com)
	 * The license,see the LICENSE file.
	 */
	 
	 $(function(){
			 $("#dg").datagrid({
//				 fitColumns:"true",
                 fit : true,
				 height:'auto',
				 singleSelect:false,
// 				 collapsible:true,
						method:'get',pagination:true,rownumbers:true,
				 url: rootpath+'/assignexam/list'
				 ,
				 onLoadSuccess:function(result){
						if (result.errorMsg){
							$.messager.show({
								title: 'Error',
								msg: result.errorMsg
							});
						} else {
						  //...
					    } 
				 },
	             onLoadError:function(e){
//		    	    console.log(e);  
			    	$.messager.show({
					title: '加载错误',
					msg: e.status+"  :  "+e.statusText
				   });
		        }
			});
			 
			 turnPage("assignexam"); 
	 });  
	
	
		function del(){
// 			var row = $('#dg').datagrid('getSelected');
			var row=$("#dg").datagrid("getSelections");
			if(row.length<=0) {
				alert("Please select one row first !");
				return ;
			}
			if (row){
				$.messager.confirm('Confirm','Are you sure delete the record(s)?',function(r){
					if (r){
						var ids;
						for(var i=0;i<row.length;i++){
							if(i==0){
								ids=(row[i].id);
							}else{
								ids+=","+row[i].id;
							}
						}
						
				         var data={};
						 data.ids=ids;
						
						  $.ajax({ 
							  type:'post',  
							  url: rootpath+'/assignexam/del',
							  data: data,  
							  dataType:'json', 
						      success:function(result){
							      if (result.errorMsg){
								    $.messager.show({	// show error message
									  title: 'Error',
									  msg: result.errorMsg
								    });
							    }else{
								    $('#dg').datagrid('reload');
								    $.messager.show({
									  title: 'delete',
									  msg: 'Delete successfully'
								    });	
							   }
						      },
					       error:function(e){  
//		                     console.log(e);  
//		                     alert(e.status+"  :  "+e.statusText);
		                    $.messager.show({
								title: 'Error',
								msg: e.status+"  :  "+e.statusText
							});
		                }
						  }
						); 
					}
				});
			}
		}
		
		function find(){
           var page=1;
           var pageSize=$("#dg").datagrid("getPager").data("pagination").options.pageSize;
           
    	 /* var data={};
		    if($('#id').val()!=""){
			data.id=$('#id').val();
		   } */
 			var data = $("#formSearch").serializeFilterNull();
 			$.post(rootpath+'/assignexam/list?page='+page+'&rows='+pageSize,data,
			     function(result){
 				
			  	    if (result.errorMsg){
				    	$.messager.show({	// show error message
						  title: 'Error',
						  msg: result.errorMsg
					 });
				    }
 				
				      if (result){
	                    //将搜索结果显示在当前页面
	                    $("#dg").datagrid("loadData", result.rows);
	                    $("#dg").datagrid("getPager").pagination('refresh', {
	                        total: result.total
	                    });
	                }
			},'json'); 
		}
		
	</script>
	
</body>
</html>